﻿
/// <reference path="../jquery/jquery-1.6.2-vsdoc.js" />
/// <reference path="../jquery/jquery-ui-1.8.11.js" />


$(document).ready(function () {
    $('#imgPopUp').bind('click', function () {
        var $this = $(this);
        var outputHolder = $("<div id='divPopUp'></div>");
        $("body").append(outputHolder);
        outputHolder.load($this.attr("href"), null, function () {
            outputHolder.dialog({
                title: '客户选择',
                modal: true,
                height: '500',
                width: '800',
                buttons: {
                    确定: function () {
                        getvalue();
                        outputHolder.dialog("close");
                    }
                }
            });
        });
        return false;
    });
});

function setcustomer() {
    $("#divPopUp").dialog("close");
}

function getvalue() {
    var $row = $("#divPopUp tr").has("input:checked");
    $("#Contract_Customerid").val($row.find("input:checked").attr("id"));
    $("#Customer_CustomerName").val($row.find("td:eq(1)").text());
    $("#Customer_Contract").val($row.find("td:eq(2)").text());
    $("#Customer_Address").val($row.find("td:eq(3)").text());
    $("#Customer_Phones").val($row.find("td:eq(4)").text());
    $("#Customer_Banks").val($row.find("td:eq(5)").text());
    $("#Customer_PostCode").val($row.find("td:eq(6)").text()); 
    $("#Customer_Account").val($row.find("td:eq(7)").text()); 
}

